﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

namespace AdornerPopup.Core.Controls
{
    public class WapComboBoxItem : ListBoxItem
    {
        static WapComboBoxItem()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(WapComboBoxItem), new FrameworkPropertyMetadata(typeof(WapComboBoxItem)));
        }

        protected override void OnSelected(RoutedEventArgs e)
        {
            WapComboBox comboBox = ItemsControl.ItemsControlFromItemContainer(this) as WapComboBox;
            if (comboBox != null)
            {
                comboBox.RaiseEvent(e);
                return;
            }

            base.OnSelected(e);
        }

        protected override void OnUnselected(RoutedEventArgs e)
        {
            WapComboBox comboBox = ItemsControl.ItemsControlFromItemContainer(this) as WapComboBox;
            if (comboBox != null)
            {
                comboBox.RaiseEvent(e);
                return;
            }

            base.OnUnselected(e);
        }
    }
}
